//
//  CityTableViewCell.m
//  TravelToHelp
//
//  Created by lanou3g on 15/10/28.
//  Copyright © 2015年 冯贵宾. All rights reserved.
//

#import "CityTableViewCell.h"

@implementation CityTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addSubviews];
    }
    return self;
}

- (void)addSubviews
{
    self.cityPhoto = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 200)];
    //self.cityPhoto.backgroundColor = [UIColor yellowColor];
    [self.contentView addSubview:self.cityPhoto];
    // 渐变虚化背景图片
    for (int i = 0; i < 50; i ++) {  // 50虚化的高度与颜色深浅
        CGFloat num = 1.0 / 50 *(50 - i);
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, self.cityPhoto.height - i, self.cityPhoto.width, 1)];   // _coverImageView背景图片
        view.backgroundColor = [UIColor colorWithRed:0 / 255.0 green:0 / 255.0 blue:0 / 255.0  alpha:num];
        [self.cityPhoto addSubview:view];
    }
    
    
    self.cityNameLB = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 50, 25)];
   // self.cityNameLB.backgroundColor = [UIColor purpleColor];
    self.cityNameLB.textColor = [UIColor whiteColor];
    [self.cityPhoto addSubview:self.cityNameLB];
    
    self.praiseLB = [[UILabel alloc] initWithFrame:CGRectMake(0, 180, kScreenWidth, 20)];
    //self.praiseLB.backgroundColor = [UIColor grayColor];
    self.praiseLB.alpha = 0.7;
    self.praiseLB.textAlignment = YES;
    self.praiseLB.textColor = [UIColor whiteColor];
    [self.cityPhoto addSubview:self.praiseLB];
    
}

@end
